package coma.dou.dema;

import java.util.List;
import java.util.Objects;
import java.util.Set;

public class Tree {
    private Integer level;

    private String code;
    private String pcode;

    private String name;

    private Set<Tree> trees;


    public Tree(Integer level, String code, String pcode, String name, Set<Tree> trees) {
        this.level = level;
        this.code = code;
        this.pcode = pcode;
        this.name = name;
        this.trees = trees;
    }

    public Integer getLevel() {
        return level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getPcode() {
        return pcode;
    }

    public void setPcode(String pcode) {
        this.pcode = pcode;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Set<Tree> getTrees() {
        return trees;
    }

    public void setTrees(Set<Tree> trees) {
        this.trees = trees;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Tree tree = (Tree) o;
        return Objects.equals(level, tree.level) && Objects.equals(code, tree.code);
    }

    @Override
    public int hashCode() {
        return Objects.hash(code);
    }

    @Override
    public String toString() {
        return "Tree{" +
                "level=" + level +
                ", code='" + code + '\'' +
                ", pcode='" + pcode + '\'' +
                ", name='" + name + '\'' +
                ", trees=" + trees +
                '}';
    }
}
